<?php
require_once '../../global.inc.php';

//SESSION中取出分页信息
$totalRows      = $_SESSION["pageInfoTemplate"]["totalRows"];		//总记录数
$pageSize       = $_SESSION["pageInfoTemplate"]["pageSize"];		//每页记录数
$currentPage    = $_SESSION["pageInfoTemplate"]["currentPage"];		//当前页数
$totalPages     = $_SESSION["pageInfoTemplate"]["totalPages"];		//总页数
$startRow       = $_SESSION["pageInfoTemplate"]["startRow"];		//每页记录开始位置
$firstPage      = $_SESSION["pageInfoTemplate"]["firstPage"];		//首页
$prewPage       = $_SESSION["pageInfoTemplate"]["prewPage"];		//上一页
$nextPage       = $_SESSION["pageInfoTemplate"]["nextPage"];		//下一页
$lastPage       = $_SESSION["pageInfoTemplate"]["lastPage"];		//尾页
//SESSION中取出页面内数据信息
$templateArray	= $_SESSION["templateArray"];		//二维数组
$tag			= $_SESSION["tag"];				//查询后的展示方式（列表q，列表编辑e,生成实例i)

//释放不需要的SESSION资源
//unset($_SESSION["pageInfo"]);
//unset($_SESSION["userArray"]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}
a {text-decoration:none}
a:hover {text-decoration:none}
img {border:0px;}
.STYLE1 {
	color: #e1e2e3;
	font-size: 12px;
}
.STYLE6 {color: #000000; font-size: 12; }
.STYLE10 {color: #000000; font-size: 12px; }
.STYLE19 {
	color: #344b50;
	font-size: 12px;
}
.STYLE21 {
	font-size: 12px;
	color: #3b6375;
}
.STYLE22 {
	font-size: 12px;
	color: #295568;
}
-->
</style>
<script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="js/template.js"></script>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="24" bgcolor="#353c44"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td  width="70%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="6%" height="19" valign="bottom"><div align="center"><img src="../images/tb.gif" width="14" height="14" /></div></td>
                <td width="94%" valign="bottom"><div align="left"><span class="STYLE1">活动模板信息列表</span></div></td>
              </tr>
            </table></td>
            <td>

            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
      <tr>

        <td width="20%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">模板名称</span></div></td>
        <td width="25%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">模板内容</span></div></td>
        <td width="10%"  height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">预估费用</span></div></td>
      <?php 
      if ($tag=="e"||$tag=="i"){
        echo "<td width='8%' height='20' bgcolor='d3eaef' class='STYLE6'><div align='center'><span class='STYLE10'>基本操作</span></div></td>";
      }else{
      	echo "<td width='8%' height='20' bgcolor='d3eaef' class='STYLE6'><div align='center'><span class='STYLE10'>详细信息</span></div></td>";
      }
      ?>
        
      </tr>
      <?php 
      foreach ($templateArray as $template) {
		$activityId		= $template["activity_id"];		//活动编号
		$subject 		= $template["subject"];			//活动名称
		$travel 		= $template["travel"];			//活动内容
		$fee			= $template["fee"];				//预估费用
		$subTravel		= substr($travel,0,80)."…";
		echo "<tr>";
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$subject</div></td>";      
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$subTravel</div></td>";
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$fee</div></td>";
	    if ($tag=="e"){//编辑活动资料
			echo "<td height='20' bgcolor='#FFFFFF'><div align='center' class='STYLE21'>";
	        echo "<a href='../../action/templateAction.php?op=get&tag=e&id=$activityId' target='rightFrame'><img src='../images/edit.gif' width='10' height='10' title='编辑'/></a>&nbsp|&nbsp";
	        echo "<a href='#' target='rightFrame'><img src='../images/del.gif' width='10' height='10' title='删除' onclick='invalid($activityId)'/></a>";
	        echo "</div></td>";
	    }else if($tag=="q"){//显示活动详细信息
			echo "<td height='20' bgcolor='#FFFFFF'><div align='center' class='STYLE21'>";
			echo "<a href='../../action/templateAction.php?op=get&tag=q&id=$activityId' target='rightFrame'><img src='../images/add.gif' width='10' height='10' title='详细信息'/> </a>";
			echo "</div></td>";
		}else if($tag=="i"){//提取模板生成实例
			echo "<td height='20' bgcolor='#FFFFFF'><div align='center' class='STYLE21'>";
			echo "<a href='../../action/templateAction.php?op=get&tag=i&id=$activityId' target='rightFrame'>提取模板</a>";
			echo "</div></td>";
		}
		echo "</tr>";
      }
	 ?>
    </table></td>
  </tr>
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="33%"><div align="left">
        	<span class="STYLE22">&nbsp;&nbsp;&nbsp;&nbsp;
	        	共有<strong><?php echo $totalRows ?></strong> 条记录，
	        	当前第<strong><?php echo $currentPage ?></strong> 页，
	        	共 <strong><?php echo $totalPages ?></strong> 页
        	</span>
        </div></td>
        <td width="67%"><table width="312" border="0" align="right" cellpadding="0" cellspacing="0">
          <tr>
            <td width="49"><div align="center"><a href='../../action/templateAction.php?op=query&p=<?php echo $firstPage?>' target='rightFrame'><img src="../images/main_54.gif" width="40" height="15" /></a></div></td>
            <td width="49"><div align="center"><a href='../../action/templateAction.php?op=query&p=<?php echo $prewPage?>' target='rightFrame'><img src="../images/main_56.gif" width="45" height="15" /></a></div></td>
            <td width="49"><div align="center"><a href='../../action/templateAction.php?op=query&p=<?php echo $nextPage?>' target='rightFrame'><img src="../images/main_58.gif" width="45" height="15" /></a></div></td>
            <td width="49"><div align="center"><a href='../../action/templateAction.php?op=query&p=<?php echo $lastPage?>' target='rightFrame'><img src="../images/main_60.gif" width="40" height="15" /></a></div></td>
            <td width="37" class="STYLE22"><div align="center">转到</div></td>
            <td width="22"><div align="center">
              <input type="text" name="textfield" id="textfield"  style="width:20px; height:12px; font-size:12px; border:solid 1px #7aaebd;"/>
            </div></td>
            <td width="22" class="STYLE22"><div align="center">页</div></td>
            <td width="35"><img src="../images/main_62.gif" width="26" height="15"  onclick="jumpToPage()"/></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
